NOTE: This Technical Q&A has been retired. Please see the Technical Q&As page for current documentation.

Technical Q&A OPS15
Calling Control Strip Routines from PowerPC Code

Q I'm trying to call the routines SBIsControlStripVisible() and SBShowHideControlStrip() defined in the header file <ControlStrip.h>. When I try to link the PowerPC code, I get a link error on these routines. Which library are they implemented in?

A There is no PowerPC library for Control Strip calls. As a consequence, you must create a routine descriptor and perform a Mixed Mode call to the 68K library.

The following is an example of how you can call the Control Strip routines from PowerPC code:

/* Defined in current Universal Header */

#ifndef _ControlStripDispatch
enum {
    _ControlStripDispatch = 0xAAF2
};
#endif

#if GENERATINGCFM

/*  */
/*  If we're not generating CFM, then assume the */
/*  68K inlines in the headers apply instead. */
/*  */

#include <MixedMode.h>#include <OSUtils.h>pascal Boolean SBIsControlStripVisible ( void );
pascal void SBShowHideControlStrip(Boolean showIt);

/*  SBIsControlStripVisible is a Pascal routine, */
/*  dispatched from the selector in D0, returning */
/*  a Boolean result */
pascal Boolean SBIsControlStripVisible ( void )
{
    enum
        {
        uppSBIsControlStripVisibleInfo = kD0DispatchedPascalStackBased
            | RESULT_SIZE (SIZE_CODE (sizeof(Boolean)))
            | DISPATCHED_STACK_ROUTINE_SELECTOR_SIZE (kFourByteCode)
            };

            return CallUniversalProc (
            GetToolTrapAddress (_ControlStripDispatch),
            uppSBIsControlStripVisibleInfo, 0x00);
}

pascal void SBShowHideControlStrip(Boolean showIt)
{
    enum
        {
        uppSBShowHideControlStripInfo =
            kD0DispatchedPascalStackBased
            | DISPATCHED_STACK_ROUTINE_SELECTOR_SIZE (kFourByteCode)
            | DISPATCHED_STACK_ROUTINE_PARAMETER
                (1, SIZE_CODE (sizeof (showIt)))
            };

            CallUniversalProc (
            GetToolTrapAddress (_ControlStripDispatch),
            uppSBShowHideControlStripInfo, 0x01, showIt);
}

#else   /*  not GENERATINGCFM */
#include <ControlStrip.h>#endif /*  GENERATINGCFM */

Updated: 14-March-97


Developer Documentation | Technical Notes | Development Kits | Sample Code